package a.a007;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import com.swa99ylum.pxf.util.MergedRegionUtils;

public class Test1 {

	
	public static void main(String[] args) throws Exception {
		
		
		File file = new File("src/main/java/a/a007/test1.xlsx");
		System.out.println(file.getAbsolutePath());
		
		
		FileInputStream fis = new FileInputStream(file);
		XSSFWorkbook xwb = new XSSFWorkbook(fis);
		
		
		XSSFSheet sheet = xwb.getSheetAt(0);
		
		/** ===================================================== */
		
		/** 测试 "纵向 合并单元格" */
//		XSSFCell cell1 = sheet.getRow(3).getCell(2);
//		XSSFCell cell2 = sheet.getRow(5).getCell(3);
		
		XSSFCell cell1 = sheet.getRow(2).getCell(0);
		XSSFCell cell2 = sheet.getRow(4).getCell(0);
		
		MergedRegionUtils.verticalMerge(cell1, cell2);
		

		/** ===================================================== */
		FileOutputStream fo = new FileOutputStream(file);
		xwb.write(fo);
		fo.close();
		
	}
}
